package concurrent;

public class InterruptTest1 extends Thread {


    public static void main(String[] args) throws InterruptedException {
        InterruptTest1 a = new InterruptTest1();
        synchronized (InterruptTest1.class) {
            a.start();
            Thread.sleep(1000);
            a.interrupt();
            Thread.sleep(3000);
        }
        System.out.println("main结束");
    }

    @Override
    public void run() {
        try {
            System.out.println("run");
            synchronized (InterruptTest1.class) {
                System.out.println("进入sync");
            }
            System.out.println("退出sync");
        } catch (Exception e) {
            System.out.println("exception");
            e.printStackTrace();
        }
    }
}
